<div>
  <%= f.label :first_name %><br />
  <%= f.text_field :first_name %>
</div>

<div>
  <%= f.label :middle_name %><br />
  <%= f.text_field :middle_name %>
</div>

<div>
  <%= f.label :last_name %><br />
  <%= f.text_field :last_name %>
</div>

<div>
  <%= f.label :email %><br />
  <%= f.text_field :email %>
</div>

<div>
  <%= f.label :gender %><br />
  <%= f.radio_button :gender, "male", :checked => 'checked' %>Male
  <%= f.radio_button :gender, "female" %>Female
</div>

<div>
  <%= f.label "Prefered Contact Name" %><br />
  <%= f.text_field :pref_cont_name %>
</div>

<div>
  <%= f.label :birthday %><br />
  <%= f.date_select :birthday, :start_year => Time.now.year - 100 ,:end_year => Time.now.year %>
</div>
<div>
 <%= f.label "Social Security Number" %><br />
<input type="text" name="ssn1"  maxlength="3" size="3" onChange="AppendValues(this.form);"  onkeypress="return isNumberKey(event)" id = "f11" />
<input type="text" name="ssn2" maxlength="2" size="2"  onChange="AppendValues(this.form);"  onkeypress="return isNumberKey(event)"/>
<input type="text" name="ssn3" maxlength="4" size="4" onChange="AppendValues(this.form);"  onkeypress="return isNumberKey(event)"/>
</div>
<div id="meta_data" style="display:none" >
 
  <%= f.text_field :ssn %>
</div>


<div>
  <%= f.label :street_address %><br />
  <%= f.text_area :street_address ,:rows => 5 ,:cols => 34 %>
</div>
<div id ="state">
  <%= f.label :state %><br />
<%= f.select :state, us_states%>

</div>
<div id="city">
 <%= f.label :city %><br />
  <%= f.text_field :city %>
</div>
<div id= "zip">
 <%= f.label :zip%><br />
  <%= f.text_field :zip %>
</div>
<input type="checkbox" id="same_as_billing" value="" onClick="copyAddress(this)"> Mailing address is the same as the street address.
<div id = "street_address-mail">
  <%= f.label :mailing_street_address %><br />
  <%= f.text_area :mailing_street_address,:rows => 5 ,:cols => 34 %>
</div>
<div id ="state-mail">
  <%= f.label :mailing_state %><br />
<%= f.select :mailing_state, us_states%>
</div>
<div id ="city-mail">
  <%= f.label :mailing_city %><br />
  <%= f.text_field :mailing_city%>
</div>

<div id ="zip-mail">
  <%= f.label :mailing_zip %><br />
  <%= f.text_field :mailing_zip %>
</div>

<div>
  <%= f.label :phone_number %><br />
  <%= f.text_field :phone_number %>
</div>

<div>
  <%= f.label "Preferred Contact Medium" %><br />
   <%= f.radio_button :pref_contact_medium, "email", :checked => 'checked' %>Email
   <%= f.radio_button :pref_contact_medium, "mail" %>Mail
   <%= f.radio_button :pref_contact_medium, "phone" %>Phone
</div>

<div>
  <%= f.label "Preferred Contact Time" %><br />
  <%= f.select(:pref_contact_time, Client::CONTACT_TIME ) %>
</div>

<div>
  <%= f.label "Referral Source" %><br />
  <%= f.text_field :ref_source %>
</div>
<script>

 function isNumberKey(evt)
      {
         var charCode = (evt.which) ? evt.which : event.keyCode
         if (charCode > 31 && (charCode < 48 || charCode > 57))
           return  false;

         return true;
      }
function AppendValues(form)
{
   var ssn11 = form.ssn1.value + "-";
   var ssn22 = form.ssn2.value + "-";
    var ssn33 =  form.ssn3.value ;
   form.client_ssn.value = ssn11 + ssn22 + ssn33 ;
}
function copyAddress(sameAsBilling) {
 
 
   var streetAddress = document.getElementById('client_street_address').value;
   var city = document.getElementById('client_city').value;
   var stateProvince = document.getElementById('client_state').value;
   var postalCode = document.getElementById('client_zip').value;
 
   

   var copy_streetAddress = document.getElementById('client_mailing_street_address');
   var copy_city = document.getElementById('client_mailing_city');
   var copy_stateProvince = document.getElementById('client_mailing_state');
   var copy_postalCode = document.getElementById('client_mailing_zip');
      
   if (sameAsBilling.checked) {
   
      if (copy_streetAddress) copy_streetAddress.value = streetAddress;
      if (copy_city) copy_city.value = city;
      if (copy_stateProvince) copy_stateProvince.value = stateProvince;
      if (copy_postalCode) copy_postalCode.value = postalCode;
   } else {
      if (copy_firstName) copy_firstName.value = "";
      if (copy_lastName) copy_lastName.value = "";
      if (copy_streetAddress) copy_streetAddress.value = "";
      if (copy_city) copy_city.value = "";
      if (copy_stateProvince) copy_stateProvince.value = "";
      if (copy_postalCode) copy_postalCode.value = "";   
      if (copy_country) copy_country.value = "";
   }
}



var f1 = new LiveValidation('client_first_name');
f1.add( Validate.Presence );
var f2 = new LiveValidation('client_last_name');
f2.add( Validate.Presence );

var f3 = new LiveValidation('client_email');
f3.add( Validate.Presence );
f3.add( Validate.Email );
var f4 = new LiveValidation('client_street_address');
f4.add( Validate.Presence );
var f5 = new LiveValidation('client_state');
f5.add( Validate.Presence );
var f6 = new LiveValidation('client_city');
f6.add( Validate.Presence );
var f7 = new LiveValidation('client_zip');
f7.add( Validate.Presence );






</script>  

